// 红绿黄，各自亮灯时长是3s,2s,1s
function trafficLight(time) {
    return new Promise((resolve, reject) => {
        setTimeout(resolve,time)
    })
}
async function setColor(color,time) {
    console.log(color)
    return trafficLight(time)
}
async function run() {
    while(true) {
        await setColor('green',3000)
        await setColor('yellow',2000)
        await setColor('red',5000)
    }
}
run()


